package musics.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import org.hibernate.annotations.CollectionOfElements;

import base2dev.core.model.imp.EntityBase;

@Entity
public class Artist extends EntityBase<Artist> {

	private static final long serialVersionUID = 3002419960634722691L;

	private String key;
	private String name;
	private String photo = "";
	private String history;
	private long playCount;
	private long points;
	@OneToMany(cascade = CascadeType.ALL)
	private List<Album> albums;
	private String wikiUrl; 
	private String videoUrl;
	private String officialUrl; 
	private String birthPlace;
	private String nickName;
	@CollectionOfElements 
	private List<String> images= new ArrayList<String>(5);
 	
	
	
	public Artist() {

	}

	 
	

	@Transient
	public int albumsSize(){
		return getAlbums().size();
	}
	
	
	@Transient
	public int songsSize(){
		int count = 0; 
		for (Album	album :  getAlbums()) {
			count+= album.getSongs().size();
		}
		return count;
	}
	
	
	public Artist addAlbum(Album album){		
		getAlbums().add(album);
		return this; 
	}
	
	
	
	
	
	
	
	
	
	
	public String getName() {
		return name;
	}

	public Artist setName(String name) {
		this.name = name;
		return this;
	}

	public String getPhoto() {
		return photo;
	}

	public Artist setPhoto(String photo) {
		this.photo = photo;
		return this;
	}

	public long getPlayCount() {
		return playCount;
		
	}

	public Artist setPlayCount(long playCount) {
		this.playCount = playCount;
		return this;
	}

	public long getPoints() {
		return points;
	}

	public Artist setPoints(long points) {
		this.points = points;
		return this;
	}

	public String getHistory() {
		return history;
	}

	public Artist setHistory(String history) {
		this.history = history;
		return this;
	}

	public List<Album> getAlbums() {

		if ( albums == null)
			albums = new ArrayList<Album>(20);
		
		return albums;
	}

	public Artist setAlbums(List<Album> albums) {
		this.albums = albums;
		return this;
	}



	public String getWikiUrl() {
		return wikiUrl;
	}



	public Artist setWikiUrl(String wikiUrl) {
		this.wikiUrl = wikiUrl;
		return this;
	}



	public String getVideoUrl() {
		return videoUrl;
	}



	public Artist setVideoUrl(String videoUrl) {
		this.videoUrl = videoUrl;
		return this; 
	}



	public String getOfficialUrl() {
		return officialUrl;
	}



	public Artist setOfficialUrl(String officialUrl) {
		this.officialUrl = officialUrl;
		return this;
	}



	public String getBirthPlace() {
		return birthPlace;
	}



	public Artist setBirthPlace(String birthPlace) {
		this.birthPlace = birthPlace;
		return this;
	}



	public String getNickName() {
		return nickName;
	}



	public Artist setNickName(String nickName) {
		this.nickName = nickName;
		return this;
	}



	public List<String> getImages() {
		 
		return images;
	}



	public Artist setImages(List<String> images) {
		this.images = images;
		return this;
	}



	public Artist setKey(String key) {
		this.key = key;
		return this;
	}



	public String getKey() {
		return key;
	}



	public Artist addImage(String theImage) {
		getImages().add(theImage);
		return this; 
	}


  
	
	
	
}
